/**
 * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package com.hotel.test.model.impl;

import com.hotel.test.model.Booking;
import com.hotel.test.model.BookingModel;

import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.util.DateUtil;
import com.liferay.portal.kernel.util.GetterUtil;
import com.liferay.portal.kernel.util.ProxyUtil;
import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.model.CacheModel;
import com.liferay.portal.model.impl.BaseModelImpl;
import com.liferay.portal.service.ServiceContext;
import com.liferay.portal.util.PortalUtil;

import com.liferay.portlet.expando.model.ExpandoBridge;
import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;

import java.io.Serializable;

import java.sql.Types;

import java.util.Date;

/**
 * The base model implementation for the Booking service. Represents a row in the &quot;HT_Booking&quot; database table, with each column mapped to a property of this class.
 *
 * <p>
 * This implementation and its corresponding interface {@link com.hotel.test.model.BookingModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link BookingImpl}.
 * </p>
 *
 * @author Vien-IT
 * @see BookingImpl
 * @see com.hotel.test.model.Booking
 * @see com.hotel.test.model.BookingModel
 * @generated
 */
public class BookingModelImpl extends BaseModelImpl<Booking>
	implements BookingModel {
	/*
	 * NOTE FOR DEVELOPERS:
	 *
	 * Never modify or reference this class directly. All methods that expect a booking model instance should use the {@link com.hotel.test.model.Booking} interface instead.
	 */
	public static final String TABLE_NAME = "HT_Booking";
	public static final Object[][] TABLE_COLUMNS = {
			{ "bookId", Types.BIGINT },
			{ "userId", Types.BIGINT },
			{ "userName", Types.VARCHAR },
			{ "createDate", Types.TIMESTAMP },
			{ "modifiedDate", Types.TIMESTAMP },
			{ "namePersonBooking", Types.VARCHAR },
			{ "numberPhone", Types.VARCHAR },
			{ "emailBooking", Types.VARCHAR },
			{ "address", Types.VARCHAR },
			{ "numberOfGuest", Types.INTEGER },
			{ "otherRequest", Types.VARCHAR },
			{ "dayStart", Types.VARCHAR },
			{ "dayFinish", Types.VARCHAR },
			{ "hotelId", Types.BIGINT },
			{ "romId", Types.BIGINT }
		};
	public static final String TABLE_SQL_CREATE = "create table HT_Booking (bookId LONG not null primary key,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,namePersonBooking VARCHAR(75) null,numberPhone VARCHAR(75) null,emailBooking VARCHAR(75) null,address VARCHAR(75) null,numberOfGuest INTEGER,otherRequest VARCHAR(75) null,dayStart VARCHAR(75) null,dayFinish VARCHAR(75) null,hotelId LONG,romId LONG)";
	public static final String TABLE_SQL_DROP = "drop table HT_Booking";
	public static final String ORDER_BY_JPQL = " ORDER BY booking.modifiedDate ASC";
	public static final String ORDER_BY_SQL = " ORDER BY HT_Booking.modifiedDate ASC";
	public static final String DATA_SOURCE = "liferayDataSource";
	public static final String SESSION_FACTORY = "liferaySessionFactory";
	public static final String TX_MANAGER = "liferayTransactionManager";
	public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
				"value.object.entity.cache.enabled.com.hotel.test.model.Booking"),
			true);
	public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
				"value.object.finder.cache.enabled.com.hotel.test.model.Booking"),
			true);
	public static final boolean COLUMN_BITMASK_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
				"value.object.column.bitmask.enabled.com.hotel.test.model.Booking"),
			true);
	public static long DAYSTART_COLUMN_BITMASK = 1L;
	public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.util.service.ServiceProps.get(
				"lock.expiration.time.com.hotel.test.model.Booking"));

	public BookingModelImpl() {
	}

	public long getPrimaryKey() {
		return _bookId;
	}

	public void setPrimaryKey(long primaryKey) {
		setBookId(primaryKey);
	}

	public Serializable getPrimaryKeyObj() {
		return new Long(_bookId);
	}

	public void setPrimaryKeyObj(Serializable primaryKeyObj) {
		setPrimaryKey(((Long)primaryKeyObj).longValue());
	}

	public Class<?> getModelClass() {
		return Booking.class;
	}

	public String getModelClassName() {
		return Booking.class.getName();
	}

	public long getBookId() {
		return _bookId;
	}

	public void setBookId(long bookId) {
		_bookId = bookId;
	}

	public long getUserId() {
		return _userId;
	}

	public void setUserId(long userId) {
		_userId = userId;
	}

	public String getUserUuid() throws SystemException {
		return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
	}

	public void setUserUuid(String userUuid) {
		_userUuid = userUuid;
	}

	public String getUserName() {
		if (_userName == null) {
			return StringPool.BLANK;
		}
		else {
			return _userName;
		}
	}

	public void setUserName(String userName) {
		_userName = userName;
	}

	public Date getCreateDate() {
		return _createDate;
	}

	public void setCreateDate(Date createDate) {
		_createDate = createDate;
	}

	public Date getModifiedDate() {
		return _modifiedDate;
	}

	public void setModifiedDate(Date modifiedDate) {
		_columnBitmask = -1L;

		_modifiedDate = modifiedDate;
	}

	public String getNamePersonBooking() {
		if (_namePersonBooking == null) {
			return StringPool.BLANK;
		}
		else {
			return _namePersonBooking;
		}
	}

	public void setNamePersonBooking(String namePersonBooking) {
		_namePersonBooking = namePersonBooking;
	}

	public String getNumberPhone() {
		if (_numberPhone == null) {
			return StringPool.BLANK;
		}
		else {
			return _numberPhone;
		}
	}

	public void setNumberPhone(String numberPhone) {
		_numberPhone = numberPhone;
	}

	public String getEmailBooking() {
		if (_emailBooking == null) {
			return StringPool.BLANK;
		}
		else {
			return _emailBooking;
		}
	}

	public void setEmailBooking(String emailBooking) {
		_emailBooking = emailBooking;
	}

	public String getAddress() {
		if (_address == null) {
			return StringPool.BLANK;
		}
		else {
			return _address;
		}
	}

	public void setAddress(String address) {
		_address = address;
	}

	public int getNumberOfGuest() {
		return _numberOfGuest;
	}

	public void setNumberOfGuest(int numberOfGuest) {
		_numberOfGuest = numberOfGuest;
	}

	public String getOtherRequest() {
		if (_otherRequest == null) {
			return StringPool.BLANK;
		}
		else {
			return _otherRequest;
		}
	}

	public void setOtherRequest(String otherRequest) {
		_otherRequest = otherRequest;
	}

	public String getDayStart() {
		if (_dayStart == null) {
			return StringPool.BLANK;
		}
		else {
			return _dayStart;
		}
	}

	public void setDayStart(String dayStart) {
		_columnBitmask |= DAYSTART_COLUMN_BITMASK;

		if (_originalDayStart == null) {
			_originalDayStart = _dayStart;
		}

		_dayStart = dayStart;
	}

	public String getOriginalDayStart() {
		return GetterUtil.getString(_originalDayStart);
	}

	public String getDayFinish() {
		if (_dayFinish == null) {
			return StringPool.BLANK;
		}
		else {
			return _dayFinish;
		}
	}

	public void setDayFinish(String dayFinish) {
		_dayFinish = dayFinish;
	}

	public long getHotelId() {
		return _hotelId;
	}

	public void setHotelId(long hotelId) {
		_hotelId = hotelId;
	}

	public long getRomId() {
		return _romId;
	}

	public void setRomId(long romId) {
		_romId = romId;
	}

	public long getColumnBitmask() {
		return _columnBitmask;
	}

	@Override
	public Booking toEscapedModel() {
		if (_escapedModelProxy == null) {
			_escapedModelProxy = (Booking)ProxyUtil.newProxyInstance(_classLoader,
					_escapedModelProxyInterfaces,
					new AutoEscapeBeanHandler(this));
		}

		return _escapedModelProxy;
	}

	@Override
	public ExpandoBridge getExpandoBridge() {
		if (_expandoBridge == null) {
			_expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(0,
					Booking.class.getName(), getPrimaryKey());
		}

		return _expandoBridge;
	}

	@Override
	public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
		getExpandoBridge().setAttributes(serviceContext);
	}

	@Override
	public Object clone() {
		BookingImpl bookingImpl = new BookingImpl();

		bookingImpl.setBookId(getBookId());
		bookingImpl.setUserId(getUserId());
		bookingImpl.setUserName(getUserName());
		bookingImpl.setCreateDate(getCreateDate());
		bookingImpl.setModifiedDate(getModifiedDate());
		bookingImpl.setNamePersonBooking(getNamePersonBooking());
		bookingImpl.setNumberPhone(getNumberPhone());
		bookingImpl.setEmailBooking(getEmailBooking());
		bookingImpl.setAddress(getAddress());
		bookingImpl.setNumberOfGuest(getNumberOfGuest());
		bookingImpl.setOtherRequest(getOtherRequest());
		bookingImpl.setDayStart(getDayStart());
		bookingImpl.setDayFinish(getDayFinish());
		bookingImpl.setHotelId(getHotelId());
		bookingImpl.setRomId(getRomId());

		bookingImpl.resetOriginalValues();

		return bookingImpl;
	}

	public int compareTo(Booking booking) {
		int value = 0;

		value = DateUtil.compareTo(getModifiedDate(), booking.getModifiedDate());

		if (value != 0) {
			return value;
		}

		return 0;
	}

	@Override
	public boolean equals(Object obj) {
		if (obj == null) {
			return false;
		}

		Booking booking = null;

		try {
			booking = (Booking)obj;
		}
		catch (ClassCastException cce) {
			return false;
		}

		long primaryKey = booking.getPrimaryKey();

		if (getPrimaryKey() == primaryKey) {
			return true;
		}
		else {
			return false;
		}
	}

	@Override
	public int hashCode() {
		return (int)getPrimaryKey();
	}

	@Override
	public void resetOriginalValues() {
		BookingModelImpl bookingModelImpl = this;

		bookingModelImpl._originalDayStart = bookingModelImpl._dayStart;

		bookingModelImpl._columnBitmask = 0;
	}

	@Override
	public CacheModel<Booking> toCacheModel() {
		BookingCacheModel bookingCacheModel = new BookingCacheModel();

		bookingCacheModel.bookId = getBookId();

		bookingCacheModel.userId = getUserId();

		bookingCacheModel.userName = getUserName();

		String userName = bookingCacheModel.userName;

		if ((userName != null) && (userName.length() == 0)) {
			bookingCacheModel.userName = null;
		}

		Date createDate = getCreateDate();

		if (createDate != null) {
			bookingCacheModel.createDate = createDate.getTime();
		}
		else {
			bookingCacheModel.createDate = Long.MIN_VALUE;
		}

		Date modifiedDate = getModifiedDate();

		if (modifiedDate != null) {
			bookingCacheModel.modifiedDate = modifiedDate.getTime();
		}
		else {
			bookingCacheModel.modifiedDate = Long.MIN_VALUE;
		}

		bookingCacheModel.namePersonBooking = getNamePersonBooking();

		String namePersonBooking = bookingCacheModel.namePersonBooking;

		if ((namePersonBooking != null) && (namePersonBooking.length() == 0)) {
			bookingCacheModel.namePersonBooking = null;
		}

		bookingCacheModel.numberPhone = getNumberPhone();

		String numberPhone = bookingCacheModel.numberPhone;

		if ((numberPhone != null) && (numberPhone.length() == 0)) {
			bookingCacheModel.numberPhone = null;
		}

		bookingCacheModel.emailBooking = getEmailBooking();

		String emailBooking = bookingCacheModel.emailBooking;

		if ((emailBooking != null) && (emailBooking.length() == 0)) {
			bookingCacheModel.emailBooking = null;
		}

		bookingCacheModel.address = getAddress();

		String address = bookingCacheModel.address;

		if ((address != null) && (address.length() == 0)) {
			bookingCacheModel.address = null;
		}

		bookingCacheModel.numberOfGuest = getNumberOfGuest();

		bookingCacheModel.otherRequest = getOtherRequest();

		String otherRequest = bookingCacheModel.otherRequest;

		if ((otherRequest != null) && (otherRequest.length() == 0)) {
			bookingCacheModel.otherRequest = null;
		}

		bookingCacheModel.dayStart = getDayStart();

		String dayStart = bookingCacheModel.dayStart;

		if ((dayStart != null) && (dayStart.length() == 0)) {
			bookingCacheModel.dayStart = null;
		}

		bookingCacheModel.dayFinish = getDayFinish();

		String dayFinish = bookingCacheModel.dayFinish;

		if ((dayFinish != null) && (dayFinish.length() == 0)) {
			bookingCacheModel.dayFinish = null;
		}

		bookingCacheModel.hotelId = getHotelId();

		bookingCacheModel.romId = getRomId();

		return bookingCacheModel;
	}

	@Override
	public String toString() {
		StringBundler sb = new StringBundler(31);

		sb.append("{bookId=");
		sb.append(getBookId());
		sb.append(", userId=");
		sb.append(getUserId());
		sb.append(", userName=");
		sb.append(getUserName());
		sb.append(", createDate=");
		sb.append(getCreateDate());
		sb.append(", modifiedDate=");
		sb.append(getModifiedDate());
		sb.append(", namePersonBooking=");
		sb.append(getNamePersonBooking());
		sb.append(", numberPhone=");
		sb.append(getNumberPhone());
		sb.append(", emailBooking=");
		sb.append(getEmailBooking());
		sb.append(", address=");
		sb.append(getAddress());
		sb.append(", numberOfGuest=");
		sb.append(getNumberOfGuest());
		sb.append(", otherRequest=");
		sb.append(getOtherRequest());
		sb.append(", dayStart=");
		sb.append(getDayStart());
		sb.append(", dayFinish=");
		sb.append(getDayFinish());
		sb.append(", hotelId=");
		sb.append(getHotelId());
		sb.append(", romId=");
		sb.append(getRomId());
		sb.append("}");

		return sb.toString();
	}

	public String toXmlString() {
		StringBundler sb = new StringBundler(49);

		sb.append("<model><model-name>");
		sb.append("com.hotel.test.model.Booking");
		sb.append("</model-name>");

		sb.append(
			"<column><column-name>bookId</column-name><column-value><![CDATA[");
		sb.append(getBookId());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>userId</column-name><column-value><![CDATA[");
		sb.append(getUserId());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>userName</column-name><column-value><![CDATA[");
		sb.append(getUserName());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>createDate</column-name><column-value><![CDATA[");
		sb.append(getCreateDate());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
		sb.append(getModifiedDate());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>namePersonBooking</column-name><column-value><![CDATA[");
		sb.append(getNamePersonBooking());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>numberPhone</column-name><column-value><![CDATA[");
		sb.append(getNumberPhone());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>emailBooking</column-name><column-value><![CDATA[");
		sb.append(getEmailBooking());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>address</column-name><column-value><![CDATA[");
		sb.append(getAddress());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>numberOfGuest</column-name><column-value><![CDATA[");
		sb.append(getNumberOfGuest());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>otherRequest</column-name><column-value><![CDATA[");
		sb.append(getOtherRequest());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>dayStart</column-name><column-value><![CDATA[");
		sb.append(getDayStart());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>dayFinish</column-name><column-value><![CDATA[");
		sb.append(getDayFinish());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>hotelId</column-name><column-value><![CDATA[");
		sb.append(getHotelId());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>romId</column-name><column-value><![CDATA[");
		sb.append(getRomId());
		sb.append("]]></column-value></column>");

		sb.append("</model>");

		return sb.toString();
	}

	private static ClassLoader _classLoader = Booking.class.getClassLoader();
	private static Class<?>[] _escapedModelProxyInterfaces = new Class[] {
			Booking.class
		};
	private long _bookId;
	private long _userId;
	private String _userUuid;
	private String _userName;
	private Date _createDate;
	private Date _modifiedDate;
	private String _namePersonBooking;
	private String _numberPhone;
	private String _emailBooking;
	private String _address;
	private int _numberOfGuest;
	private String _otherRequest;
	private String _dayStart;
	private String _originalDayStart;
	private String _dayFinish;
	private long _hotelId;
	private long _romId;
	private transient ExpandoBridge _expandoBridge;
	private long _columnBitmask;
	private Booking _escapedModelProxy;
}